<template>
  <div class="oo">
    <div class="ps">
      <p><van-icon name="arrow-left" @click="fw" /></p>
      <p>发布动态</p>
      <p></p>
    </div>
    <div class="pt">
      <div class="ff">
        <p>动态文案</p>
        <textarea name="" id="" cols="40" rows="7" v-model="texts"></textarea>
      </div>
      <div class="oo">
        <p>动态图片</p>
        <div class="ns">
          <van-uploader
            v-model="fileList"
            multiple
            :after-read="beforeRead"
          >
            <div class="imgsrc">
              <span class="icons icon-zhaoxiangji" />
            </div>
          </van-uploader>
        </div>
      </div>
    </div>
    <router-link to="/floor">
    <div @click="upload" class="ll">
      发布
    </div>
    </router-link>
  </div>
</template>

<script>
import axios from "../../utils/axios";
export default {
  data() {
    return {
      texts: "",
      fileList: [],
      shuju: [
        {
          title: "",
          url: "",
        },
      ],
    };
  },

  methods: {
    beforeRead(file) {
      
      console.log();
    },
    fabu(hhh) {
      
    },

    fw() {
      this.$router.go(-1);
    },
    async upload() {

        let data1 = new FormData();
        this.fileList.forEach(item => {
            data1.append('file',item.file);
        });

        data1.append('content',this.texts);

        const  data  = await axios.put("addHouseRing",data1);
        console.log(data);
    },
    // upload(){
    //   this.$router.push('/floor')
    // }
  },
};
</script>

<style lang="less">
.ns{
  margin-left: -20px;
}
.oo {
  display: flex;
  flex-direction: column;
  height: 100%;
  .imgsrc {
    margin-left: 20px;
    background: #eeeeee;
    width: 82px;
    height: 69px;
  }
  .icon-zhaoxiangji {
    color: #cfcfcf !important;
    display: inline-block;
    font-size: 12vw !important;
    position: relative;
    top: 10px;
    left: 4.93333vw;
  }
}
.pt {
  flex: 1;
  overflow-y: scroll;
}
.ll {
  height: 40px;
  background: skyblue;
  text-align: center;
  line-height: 40px;
  color: white;
}
.oo .van-uploader {
  margin-left: 20px;
  margin-top: 10px;
}
.oo p {
  padding-left: 20px;
  padding-top: 10px;
}
.ff p {
  padding-left: 20px;
  padding-top: 10px;
}
.ff textarea {
  margin-left: 20px;
  margin-top: 10px;
}
.ps {
  height: 50px;
  background: blue;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ps p {
  padding: 0 20px;
  color: white;
}
</style>
